package com.dingreading.cloud.gateway.service.impl;

import com.dingreading.cloud.gateway.dto.HeadStaffDto;
import com.dingreading.cloud.gateway.entity.HeadStaff;
import com.dingreading.cloud.gateway.entity.table.HeadStaffTableDef;
import com.dingreading.cloud.gateway.mapper.HeadStaffMapper;
import com.dingreading.cloud.gateway.service.HeadStaffService;
import com.mybatisflex.core.query.QueryWrapper;
import org.springframework.stereotype.Service;


/**
 * 服务层实现。
 *
 * @author Administrator
 * @since 2023-11-22
 */
@Service
public class HeadStaffServiceImpl extends BaseServiceImpl<HeadStaffMapper, HeadStaff, HeadStaffTableDef> implements HeadStaffService {

    @Override
    protected HeadStaffTableDef getTable() {
        return HeadStaffTableDef.headStaff;
    }

    @Override
    public HeadStaff getByUid(String uid) {
        return getMapper().selectOneByCondition(table.uid.eq(uid));
    }

    @Override
    public HeadStaffDto dtoGetByUid(String uid) {
        QueryWrapper wrapper = QueryWrapper.create()
                .where(table.uid.eq(uid));
        return getMapper().selectOneByQueryAs(wrapper, HeadStaffDto.class);
    }

}
